package com.xqt.service;

import com.xqt.dao.UserDao;
import com.xqt.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by Administrator on 2017/3/10.
 */
@Service
public class UserService {

    @Autowired
    private UserDao userDao;

    @Cacheable(value = "usercache",keyGenerator = "wiselyKeyGenerator")
    public List<User>  getUser(){
        return userDao.selectUser();
    }

    @Cacheable(value = "usercache",keyGenerator = "wiselyKeyGenerator")
    public  String test(Integer s){
        return "test";
    }

    @CacheEvict(value = "usercache",allEntries=true)
    public void delete() {
        System.out.println("删除缓存");
    }

}
